package com.atguigu.gulimall.member.controller;

import com.atguigu.gulimall.member.fegin.CouponFegin;
import com.atguigu.gulimall.member.model.Member;
import com.xunqi.common.utils.R;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RefreshScope
@RestController
public class UserController {
    @Resource
    CouponFegin couponFegin;

    @Value("${coupon.user.name}")
    private String name;
    @Value("${coupon.user.age}")
    private String age;
    private String id = 0+"";
    @RequestMapping("/user/coupon")
    public R findUserConpon(){
        Member member = new Member();
        member.setNickname("用户名");
         R r =  couponFegin.romotefindCouponList();
        return R.ok().put("member",member).put("coupons",r.get("coupons"));
    }

    @RequestMapping("/test")
    public R test(){
        return R.ok().put("name",name).put("age",age).put("id",id);
    }
}
